from mediatorpattern.mediator import Mediator


class ConcreteMediator(Mediator):
    colleagues = []

    def register(self, colleague):
        if not self.colleagues.__contains__(colleague):
            self.colleagues.append(colleague)
            colleague.set_mediator(self)

    def relay(self, colleague):
        for ob in self.colleagues:
            if ob != colleague:
                ob.receive()

